<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<button class="theme-toggle" onclick="toggleTheme()">🌙</button>
<div class="grade-form-container">
    <div class="form-header">学生成绩录入</div>
<form action="addGrade" method="post">
    <div class="form-group">
        <label>学号：</label>
        <input type="text" name="studentId" value="${studentId}" readonly>
    </div>

    <div class="form-group">
        <label>课程ID：</label>
        <input type="text" name="courseId" value="${courseId}" readonly>
    </div>

    <div class="form-group">
        <label>平时成绩：</label>
        <input type="number" name="dailyScore" min="0" max="100" step="0.1" required>
    </div>

    <div class="form-group">
        <label>阶段成绩：</label>
        <input type="number" name="stageScore" min="0" max="100" step="0.1" required>
    </div>

    <div class="form-group">
        <label>期末成绩：</label>
        <input type="number" name="finalScore" min="0" max="100" step="0.1" required>
    </div>

    <button type="submit">提交成绩</button>
</form>
</div>

<link href="./css/rDBAddGradeForm.css" rel="stylesheet">
<script>
    // 初始化主题
    function initTheme() {
        const savedTheme = localStorage.getItem('theme') || 'dark';
        const isLight = savedTheme === 'light';
        document.body.classList.toggle('light-mode', isLight);
        document.querySelector('.theme-toggle').textContent = isLight ? '☀️' : '🌙';
    }

    // 切换主题
    function toggleTheme() {
        const body = document.body;
        const isLight = !body.classList.contains('light-mode');
        body.classList.toggle('light-mode');
        localStorage.setItem('theme', isLight ? 'light' : 'dark');
        document.querySelector('.theme-toggle').textContent = isLight ? '☀️' : '🌙';
    }

    // 页面加载时初始化
    window.addEventListener('load', initTheme);

</script>
